package et.common;

import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import et.item.ETItemManager;
import et.recipe.ETRecipeManager;
import et.recipe.ETRecipes;
import et.research.ETResearchManager;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by winston_wang on 2017/6/2.
 */
public class CommonProxy {
    protected ETResearchManager researchManager;
    protected ETItemManager itemManager;
    protected ETRecipeManager recipeManager;
    public void preInit(FMLPreInitializationEvent event){
        recipeManager= new ETRecipeManager(getModList());
        ETRecipes.initOtherRecipe();
        itemManager=new ETItemManager(getModList());
    }
    public void init(FMLInitializationEvent event){

    }
    public void postInit(FMLPostInitializationEvent event){
        researchManager=new ETResearchManager(getModList());
    }
    public String[] getModList(){
        List<ModContainer> mods = Loader.instance().getModList();
        ArrayList<String> modids = new ArrayList<String>();
        for(int i = 0;i<mods.size();i++){
            modids.add(mods.get(i).getModId());
        }
        return modids.toArray(new String[]{});
    }
}
